<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Relation Analyzer</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../css/style.css" type="text/css"></head>

<body>
<table width="100%" border="0" cellpadding="4">
  <tr>
    <td class="head" height="16">Relation Analyzer</td>
  </tr>
  <tr>
    <td bgcolor="#FF9900" height="6"></td>
  </tr>
  <tr>
    <td height=6></td>
  </tr>
</table>
<p class="text">Welcome to CnPack Relation Analyzer in CnPack IDE Wizards.</p>
<p class="text">This Tool is Used to analyze executable files generated by Delphi, get its packages and units information. And it also can get the relations between packages, and relations between packages and its units.</p>
<p class="text">Analyzed result can be saved to an ARF File. And we can create an SMR file from an ARF file to query/view the relations between the executables and source files later.
<p class="text">For common situation, you can open one or more executable files in "Analyze Executable Files" page and analyze them. analyzed result can be save to an ARF file and re-opened in "View Analyzed Result Files" page.</p>
<p class="text">ARF is generated by analyzed result, which only contains the relations between the executables and pascal source file NAME, NO path information and other file types. For advanced situation, you can open an ARF file in "Edit Source-Module Relations" page to edit it and generate an SMR file, which contains the relations between the executables and full path information of source files. Then you can view SMR files in "View Source-Module Relations" page later.</p>
<p class="text">&nbsp;</p>
<p class="title" align="left">Analyze Executable Files</p>

<p class="text" align="left">"Analyze Executable Files" is the basic function of Relation Analyzer. It can open executable files and analyze it to get the names of packages and units in executable files. It's shown as below:</p>
<p class="text" align="center"><img src="cnsmr1.png"></p>
<p class="text" align="left">&nbsp;</p>
<ul>
  <li><b>Add Executable Files</b>: Open executable files and add to list to analyze.</li>
  <li>
    <p class="text"><b>Analyze Selected File</b>: Analyze the selected file in the list to get its package and unit information.
  </li>
  <li>
    <p class="text"><b>Analyze All Files</b>: Analyze all files in the list to get their package and unit information
  </li>
  <li>
    <p class="text"><b>Clear All Files</b>: Clear the file list, include the analyze result.
  </li>
  <li>
    <p class="text"><b>Save Analyzed Result</b>: Save current analyzed result to an ARF file. It's an INI file, which can be opened by notepad.  </li>
  <li>
    <p class="text"><b>Append Analyzed Result</b>: Append current analyzed result to an existing ARF file.
  </li>
</ul>
<p class="text" align="left">&nbsp;</p>
<p class="title" align="left">View Analyzed Result</p>
<p class="text" align="left">A saved ARF file can be re-opened here to view its content. This page can view the file relations by executable file or unit. It's shown as below: </p>
<p class="text" align="center"><img src="cnsmr2.png"></p>
<ul>
  <li>
    <p class="text"><b>Open Saved Result</b>: Open a saved ARF file and display its content.</li>
  <li>
    <p class="text"><b>Clear</b>: Clear contents in current page.</li>
  <li>
  <p class="text"><b>View by Executable Files</b>: Above is shown as the ARF file is viewed by executable files. The executable files are displayed in list. If an executable file is selected, the packages and units which it contains, and the executable files which used it, will be displayed.  
  <ul>
    <li><b>Contained Units</b>: List the unit names used by selected executable file.</li>
    <li><b>Required Packages</b>: List the package names DIRECTLY used(build with, or keyword "requires") by selected executable file.</li>
    <li><b>All Required Packages</b>: List the package names directly used(build with, or keyword "requires") and indirectly, recursively used by selected executable file. For example, if a.exe used b.bpl, and b.bpl requires c.bpl, and when a.exe selected, "Required Packages" should contain b.bpl, and "All Required Packages" should contain b.bpl and c.bpl. Generally, "All Required Packages" shows the all required packages to compile this executable file.</li>
    <li><b>Package Used by</b>: List the executable files that DIRECTLY used selected executable file(bpl).</li>
    <li><b>All Package Used by</b>: List the executable files that directly and indirectly, recursively used selected executable file(bpl). For example, if c.exe build with b.bpl, and b.bpl requires a.bpl, when a.bpl is selected, "Package Used by" should contain b.bpl, "All Package Used by" should contain b.bpl and c.exe.</li>
  </ul>
  </li>
  <li>
    <p class="text"><b>Previous View</b>: If double click an executable file in these lists, it will jump to this file and show its relations. Previous View can jump back to see the file just shown, not the previous file in the list.</li>
  <li>
  <p class="text"><b>Next View</b>: If pressed "Previous View" to jump back, press "Next View" can jump forward.</li>
  <li>
    <p class="text"><b>Find File</b>: This Edit is used to locate file quickly, wild char supported. Up and down arrow key can move up and down  in file list. Ctrl + Home and Ctrl + End can move to the first and last one in file list. Ctrl + Up and Ctrl + Down can find previous one and next one in file list. This function is similar to the one at other pages.
  </li>
  <li><b>View by Units</b>: Double clicking a Unit in "Contained Unit" can View this unit's information. The packages used this unit will be displayed as below:</li>
  <p align="center" class="text"><img src="cnsmr3.png"></p>
  <ul>
    <li><b>Packages who Used</b>: List the executable files that DIRECTLY used selected unit.</li>
    <li><b>All Packages who Used</b>: List the executable files that directly and indirectly, recursively used selected unit. For example, if a.bpl requires b.bpl, and b.bpl uses bb.pas, when bb.pas is selected in units list, "Packages who Used" should contain b.bpl, and "All Packages who Used" should contain a.bpl and b.bpl.</li>
  </ul>
  <li><b>Duplicated Units</b>: Duplicated units used by some executable files can be shown as below:</li>
    <p align="center" class="text"><img src="cnsmr4.png"></p>
  <li>
  <p class="text"><b>Available Executable Files</b>: List all executable files in this ARF file.</li>
  <li>
  <p class="text"><b>Add</b>: Pressing "Add" button or double clicking an executable file can add the file to "Selected Executable Files" List.</li>
  <li><b>Add All</b>: Pressing "Add All" button can add all files to "Selected Executable Files" List.</li>
  <li>
  <p class="text"><b>Selected Executable Files</b>: Selected Executable Files List. Duplicated units will be fetched out from them.</p></li>
  <li><p class="text"><b>Remove</b>: Remove selected file from "Selected Executable Files" List.</p></li>
  <li><p class="text"><b>Remove All</b>: Remove all files from "Selected Executable Files" List.</p></li>
  <li><p class="text"><b>Duplicated Units</b>: When "Selected Executable Files" List changed, their units with same name will be displayed in this list.</p></li>
  <li>
    <p class="text"><b>Save</b>: Save Duplicated units name to a file.</li>
</ul>
<p class="text" align="left">&nbsp;</p>
<p class="title" align="left">Edit Source-Module Relations</p>
<p class="text" align="left">An ARF file only contents the relations between executable files and Packages/Units file NAME without the path information. If we want to get and maintain a source file-executable file relation database from a project, we can construct an SMR file, filling the package/unit names with full path information. This page is shown as below: </p>
<p class="text" align="center"><img src="cnsmr5.png"></p>
<p class="text" align="left">An SMR file contains some source files with full path information and the relations between them and some executable files. To generate a full SMR file, we need an ARF file and a file list. ARF file comes from previous pages, and the file list contains the full path and file names under certain directory, which can be generated from "Files List" Page.</p>
<ul>
  <li>
    <p class="text"><b>New/Open SMR File</b>: This button contain a dropdown menu related to SMR file operations.
    <ul>
      <li><b class="text">Open an SMR File</b>: Open an existing SMR file to edit.</li>
      <li><b class="text">Close SMR File</b>: If an SMR file is opened for editing, this item can close this SMR file. If need saving, please press "Save SMR File" before closing.</li>
      <li><b class="text">New an SMR File</b>: New an empty SMR file for editing.</li>
      <li><b class="text">New an SMR File from Files List</b>: Open a files list file and new an SMR file based on this list file. This function is mostly used when creating SMR file to avoid enter source file path/names manually.</li>
    </ul>
  </li>
  <li>
    <p class="text"><b>Open/Close ARF File</b>: This button contains a dropdown menu related to ARF file operations.
    <ul>
      <li><b class="text">Open an ARF File</b>: Open an existing ARF file for filling SMR file.</li>
      <li><b class="text">Close ARF File</b>: If an ARF file is opened for filling, this item can close this ARF file.</li>
    </ul>
  </li>
  <li>
  <p class="text"><b>Auto Fill Data</b>: If the source files list in SMR are ready, and corresponding ARF file is opened, this function will fill the relations between source files and executable files according to the package/unit name in ARF. For each line in SMR source file, its file name will be extracted and this function will search the same file name in ARF. If matched, the relation is constructed. Note: if there're some files with same name but different path, the filling maybe cause mistake for ARF does not contain the path information. For this situation, we need to adjust them manually.
  <ul>
    <li><b class="text">Fill Selected Source-Module Relation</b>: If a file is selected in "Source File" list, it will search its file name in ARF and get its corresponding executable files' information.</li>
    <li><b class="text">Fill All Source-Module Relations</b>: Search the file name of "Source File" list one by one in ARF file to get their corresponding executable files' information.</li>
  </ul>
  </li>
  <li><p class="text"><b>Save SMR File</b>: If the relations filled, this SMR file, which contains the relations between executable files and certain source files with full path information, can be saved to disk and re-opened later.</li>
  <li><p class="text"><b>DBNavigator Buttons</b>: The source files and relations are stored in Data set mode in this program, so there is an DBNavigator to operate the records. Such as new a source file, delete a source file, etc.</li>
  <li><p class="text"><b>Affected Modules if NO Interface Changed</b>: If a source file is selected, this list will contain those executable files that use this unit DIRECTLY. In another word, if the implementation part of this unit is modified, the executable files in the list, and only the executable files in the list, need to be re-compiled.</li>
  <li><p class="text"><b>Affected Modules if Interface Changed</b>: If a source file is selected, this list will contain those executable files that use this unit directly and indirectly but not recursively. For an example, if a.bpl contains units a.pas, and b.bpl requires a.bpl, c.bpl requires b.bpl. if implementation of a.pas changed, only a.bpl need to re-build, for a.bpl's external interface remains unchanged. But if interface of a.pas changed, a.bpl's external interface will change, too. So b.bpl, which requires a.bpl, need to re-build. And c.bpl does not need re-build for b.bpl's external interface not changed. <br>
  </li>
</ul>
<p class="title">View Source-Module Relations</p>
<p class="text">This page can open an existing SMR file and view it. The page is similar as "Edit Source-Module Relations" shown as below: </p>
<p align="center" class="text"><img src="cnsmr6.png"></p>
<ul>
  <li>
  <p class="text"><b>Open SMR File</b>: Open an SMR File to view it.</li>
  <li>
    <p class="text"><b>Clear</b>: Clear display content.</li>
  <li>
  <p class="text"><b>Previous View</b>: Go back to the file just viewed.</li>
  <li>
  <p class="text"><b>Next View</b>: Go forward after go back to the file just viewed.</li>
</ul>
<p class="text">Other UI items are similar to those in "Edit Source-Module Relations".</p>
<p class="text">&nbsp;</p>
<p class="title">Files List</p>
<p class="text">This function is used to generate a source files list under a certain directory for SMR file editing. The page is shown as below. Left is the search result shown as a tree. Right is the file list generated from the tree. The list needs to save to a text file for SMR file editing.</p>
<p align="center" class="text"><img src="cnsmr7.png"></p>
<ul>
  <li><b>Directory</b>: Browse and select a directory as a root for searching.</li>
  <li>
    <p class="text"><b>Include Subdirectories</b>: Whether include subdirectories when searching under root.</li>
  <li>
  <p class="text"><b>Relative Path</b>: Use relative path in search result and generated text.</li>
  <li>
  <p class="text"><b>File Masks</b>: File masks using in search to avoid useless file. Wild char supported.</li>
  <li>
  <p class="text"><b>Case Sensitive</b>: Whether case sensitive when searching using file masks.</li>
  <li>
  <p class="text"><b>Search</b>: Search the files according to the selected root directory and options.</li>
  <li>
  <p class="text"><b>Generate</b>: If search result is not empty, pressing this button to generate the file list. If "Auto Generate" checkbox is checked, the file list will be updated automatically without clicking this button.</li>
  <li><b>Directories</b>: Whether list the directories in generated list, defaultly NOT.</li>
  <li>
    <p class="text"><b>Files</b>: Whether list the files in generated list.</li>
  <li>
    <p class="text"><b>Auto Generate</b>: Whether auto generate file list after tree content changed. If not checked, we need to press "Generate" button to update the file list.</li>
  <li>
    <p class="text"><b>Save</b>: Save list to a text file.
  </li>
</ul>
<p class="text">Right click to popup the popupmenu. User can do some common operation to the tree contents. They do not affect the disk files, only the tree contents.</p>
<p class="text">PS. The screenshots in this help document are an example of analyzing executable files of Delphi 5 and its VCL source code files. It's an good example for this tool.</p>
<p class="text">&nbsp;</p>
<p class="title" align="left">Links<p class="text" align="left">
<a href="../licenses/license.htm">CnPack IDE Wizards License</a><p class="text" align="left">
<a href="../cnpack/about.htm">About CnPack</a><p class="text" align="left">&nbsp;<hr>
<p class="text" align="center"><a href="http://www.cnpack.org">Copyrights 2001-2020 CnPack Team</a></p>
</body>
</html>
